/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package meteocal.business.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author luana
 */
@Entity
@Table(name = "BAD_WEATHER")
@NamedQueries({
    @NamedQuery(name = "BadWeather.findAll", query = "SELECT b FROM BadWeather b"),
    @NamedQuery(name = "BadWeather.findByIdConstraint", query = "SELECT b FROM BadWeather b WHERE b.idConstraint = :idConstraint"),
    @NamedQuery(name = BadWeather.FIND_BY_EVENT, query = "SELECT b FROM BadWeather b WHERE b.idEvent = :idEvent"),
    @NamedQuery(name = "BadWeather.findByWeatherCategory", query = "SELECT b FROM BadWeather b WHERE b.weatherCategory = :weatherCategory"),
    @NamedQuery(name = BadWeather.FIND_BAD_EVENT, query = "SELECT b FROM BadWeather b WHERE b.weatherCategory = :weatherCategory AND b.idEvent = :idEvent" )})

public class BadWeather implements Serializable {
    
    public static final String FIND_BAD_EVENT = "BadWeather.findBadForEvent";
    public static final String FIND_BY_EVENT = "BadWeather.findbyIdEvent";
    
    private static final long serialVersionUID = 1L;
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_CONSTRAINT")
    private Integer idConstraint;
    
    @JoinColumn(name = "ID_EVENT", referencedColumnName = "ID_EVENT")
    @ManyToOne(optional = false)
    private Event idEvent;
    
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "WEATHER_CATEGORY")
    private String weatherCategory;

    public BadWeather() {
    }

    public BadWeather(Integer idConstraint) {
        this.idConstraint = idConstraint;
    }

    public BadWeather(Integer idConstraint, Event idEvent, String weatherCategory) {
        this.idConstraint = idConstraint;
        this.idEvent = idEvent;
        this.weatherCategory = weatherCategory;
    }

    public Integer getIdConstraint() {
        return idConstraint;
    }

    public void setIdConstraint(Integer idConstraint) {
        this.idConstraint = idConstraint;
    }

    
    public String getWeatherCategory() {
        return weatherCategory;
    }

    public void setWeatherCategory(String weatherCategory) {
        this.weatherCategory = weatherCategory;
    }

    public Event getIdEvent() {
        return idEvent;
    }

    public void setIdEvent(Event idEvent) {
        this.idEvent = idEvent;
    }

    
}
